
package com.jf.cloud.im;

import com.jf.cloud.im.socket.app.UserOnlineWebSocketServer;
import com.jf.cloud.im.socket.app.UserWebSocketServer;
import com.jf.cloud.im.socket.multishop.ShopOnlineWebSocketServer;
import com.jf.cloud.im.socket.multishop.ShopWebSocketServer;
import com.jf.cloud.im.socket.platform.SysOnlineWebSocketServer;
import com.jf.cloud.im.socket.platform.SysWebSocketServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author zz
 * @date 2020/6/24
 */
@SpringBootApplication(scanBasePackages = {"com.jf.cloud"}, exclude = UserDetailsServiceAutoConfiguration.class)
@EnableFeignClients(basePackages = {"com.jf.cloud.**.feign"})
public class ImApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ImApplication.class, args);
        UserWebSocketServer.setApplicationContext(applicationContext);
        ShopWebSocketServer.setApplicationContext(applicationContext);
        SysWebSocketServer.setApplicationContext(applicationContext);
        UserOnlineWebSocketServer.setApplicationContext(applicationContext);
        ShopOnlineWebSocketServer.setApplicationContext(applicationContext);
        SysOnlineWebSocketServer.setApplicationContext(applicationContext);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(ImApplication.class);
    }

}
